﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HotelMgr.Models;

namespace HotelMgr.Controllers
{
    public class NoticeController : Controller
    {
        HotelEntities db=new HotelEntities();
        //
        // GET: /Notice/

        public ActionResult Index()
        {
            //get a notice
            var notice = db.Notices.OrderByDescending(n => n.AddDate).FirstOrDefault();
               
            return View(notice);
        }

        // 公告详情
        // GET: /Notice/Details/5
        public ActionResult Details(int id)
        {
            var notice = db.Notices.Find(id);
            return View(notice);
        }

        // 公告列表
        // GET: /Notice/List/
        public ActionResult List()
        {
            var notices = db.Notices.ToList();
            return View(notices);
        }

       
        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }

    }
}
